public class BankAccount {
    private double balance;

    public BankAccount(double initialBalance){
        this.balance=initialBalance;
    }

    public void deposit(double amount){
        balance+=amount;
        System.out.println("Deposited:$"+amount);
        System.out.println("New balance:$"+balance);
    }

    public void withdraw(double amount){
        balance-=amount;
        System.out.println("Withdrew:$"+amount);
        System.out.println("New balance:$"+balance);
    }

    public double getBalance() {
        return balance;
    }

    private void printBalance(){
        System.out.println("Balance(should not be directly accessible):$"+balance);
    }

    public static void main(String[]args){

        BankAccount account=new BankAccount(1000.0);

        account.deposit(500.0);

        account.withdraw(200.0);

        System.out.println("Account balance:$"+account.getBalance());


    }
}
